import {
	request,
	baseUrl
} from "../request.js"

//域名 端口号
//var baseUrl = 'https://wzxlovemzy.com:6001/user'


/**
 * 1，获取用户聊天信息
 * @param {*} reqData 
 */
export function getMsgByUser(reqData) {
	return request({
		url: baseUrl + '/msg/getMsgByUser',
		method: 'POST',
		data: {
			senderId: reqData.senderId,
			receiverId: reqData.receiverId,
			page: reqData.page,
			size: reqData.size
		}
	})
}

/**
 * 2，获取系统信息
 * @param {Object} userId
 * @param {Object} page
 * @param {Object} size
 */
export function getSysMsg(page, size, msgType) {
	return request({
		url: baseUrl + '/msg/getMsgBySystem',
		method: 'POST',
		data: {
			userId: uni.getStorageSync('userId'),
			page: page,
			size: size,
			msgType: msgType
		}
	})
}

/**
 * 3，删除系统消息
 * @param {Object} sysIds
 */
export function cleanAllSyStemMsg(sysIds) {
	return request({
		url: baseUrl + '/msg/cleanAllSyStemMsg?sysIds=' + sysIds,
		method: 'GET'
	})
}

/**
 * 获取消息列表
 */
export function getMsgs(userId) {
	return request({
		url: baseUrl + '/msg/getMsgs?userId=' + userId || uni.getStorageSync('userId'),
		method: 'GET'
	})
}

//删除所有
export function cleanAllSyStemMsgAll() {
	return request({
		url: baseUrl + '/msg/cleanAllSyStemMsgAll?userId=' + uni.getStorageSync('userId'),
		method: 'GET'
	})
}

//查询未读历史消息
export function getNotReadMsg() {
	return request({
		url: baseUrl + '/msg/getNotReadMsg?userId=' + uni.getStorageSync('userId'),
		method: 'GET'
	})
}

//更改未读消息状态
export function updateNotReadMsg() {
	return request({
		url: baseUrl + '/msg/updateNotReadMsg?userId=' + uni.getStorageSync('userId'),
		method: 'GET'
	})
}
